#include <iostream>
#include <string> 
#include <vector>

size_t split(const std::string& str, const std::string& sep, std::vector<std::string>* result)
{
    size_t pos = 0, idx = 0;
    while (idx < str.size())
    {
        pos = str.find(sep, idx);
        if (pos == std::string::npos)
        {
            result->emplace_back(str.substr(idx));
            break;
        }
        if (pos > idx)
            result->emplace_back(str.substr(idx, pos - idx));
        idx = pos + sep.size();
    }
    return result->size();
}

int main()
{
    std::string str = "...vip.#....music...";
    std::vector<std::string> array;
    split(str, ".", &array);
    for (const auto& s: array)
    {
        std::cout << s << std::endl;
    }

    return 0;
}